import Vue from 'vue'
import Router from 'vue-router'
import Login from './Login' // 登录
import vuex from "../store";
Vue.use(Router);

let router =  new Router({
    mode: 'history',// 真路由，去除多余的#号
    routes: [
        ...Login,
    ]
})


// 全局路由守护
router.beforeEach((to,from,next) => {
    if (to.name != 'Login' && (vuex.getters.getLoginKey()) != 'yhfkey') {
        next({name: 'Login'})
    }
    next()
})

export default router